package com.uccart_project.ui.panels;

import com.uccart_project.controller.Controller_Application;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

public class UI_Panel_MenuPrincipal extends javax.swing.JPanel {

    private Controller_Application controller_Application;
    private ImageIcon fondo;

    private UI_Panel_MenuPrincipal() {
        initComponents();
    }

    public UI_Panel_MenuPrincipal(Controller_Application controller_Application) {
        initComponents();
        this.controller_Application = controller_Application;
        //PARA LABELS DEL NOMBRE
        this.jLabelNombrePPrincipal.setText("BIENVENIDO: " + controller_Application.getUserInfo());
        fondo = new ImageIcon(getClass().getResource("/com/uccart_project/ui/iconos/fondo.png"));
        this.jPanel1.setOpaque(false);
        this.jPanel2.setOpaque(false);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();
        jLabelNombrePPrincipal = new javax.swing.JLabel();

        setBackground(new java.awt.Color(255, 255, 255));
        setMaximumSize(new java.awt.Dimension(22767, 22767));
        setPreferredSize(new java.awt.Dimension(700, 480));

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/uccart_project/ui/iconos/uccart.png"))); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        jLabel4.setBackground(new java.awt.Color(255, 255, 255));
        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText("Información de Usuario");
        jLabel4.setToolTipText("Cambiar Contraseña Usuario");
        jLabel4.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jLabel4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mouseClickedEstadoCuenta(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                mouseExitedPutNormal(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                mouseEnteredPutRed(evt);
            }
        });

        jLabel2.setBackground(new java.awt.Color(255, 255, 255));
        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("Sistema Financiero");
        jLabel2.setToolTipText("Sistema Financiero");
        jLabel2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mouseClickedGoMatricula(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                mouseExitedPutNormal(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                mouseEnteredPutRed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addGap(18, 18, 18)
                .addComponent(jLabel4)
                .addContainerGap())
        );

        jLabel2.getAccessibleContext().setAccessibleDescription("Sistema Financiero");

        jButton3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/uccart_project/ui/iconos/Close 1 ok.png"))); // NOI18N
        jButton3.setText("Cerrar Sesión");
        jButton3.setToolTipText("Cerrar Sesion");
        jButton3.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/com/uccart_project/ui/iconos/Close 1 ok.png"))); // NOI18N
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jLabelNombrePPrincipal.setFont(new java.awt.Font("Ubuntu", 1, 16)); // NOI18N
        jLabelNombrePPrincipal.setText("Información del usuario");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabelNombrePPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, 471, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 84, Short.MAX_VALUE)
                        .addComponent(jButton3)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelNombrePPrincipal)
                    .addComponent(jButton3))
                .addGap(49, 49, 49)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(82, Short.MAX_VALUE))
        );

        jLabelNombrePPrincipal.getAccessibleContext().setAccessibleName("Información de usuario");
    }// </editor-fold>//GEN-END:initComponents

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        this.controller_Application.cerrarSession();
    }//GEN-LAST:event_jButton3ActionPerformed

    private void mouseEnteredPutRed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseEnteredPutRed
        JLabel label = (JLabel) evt.getSource();
        label.setForeground(Color.red);
    }//GEN-LAST:event_mouseEnteredPutRed

    private void mouseExitedPutNormal(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseExitedPutNormal
        JLabel label = (JLabel) evt.getSource();
        label.setForeground(Color.BLACK);
    }//GEN-LAST:event_mouseExitedPutNormal

    private void mouseClickedGoMatricula(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickedGoMatricula
        this.controller_Application.mostrarPanelModulo();
    }//GEN-LAST:event_mouseClickedGoMatricula

    private void mouseClickedEstadoCuenta(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mouseClickedEstadoCuenta
       this.controller_Application.mostrarPanelInformacion();
    }//GEN-LAST:event_mouseClickedEstadoCuenta

    public JLabel getLabel2(){
        return this.jLabel2;
    } 
    @Override
    public void paint(Graphics grphcs) {
        //To change body of generated methods, choose Tools | Templates.
        setOpaque(false);
        grphcs.drawImage(fondo.getImage(), 0, 0, null); //no need for ImageObserver here
        super.paint(grphcs);
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabelNombrePPrincipal;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    // End of variables declaration//GEN-END:variables
}
